package com.shhimto.member.client.ui;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Cursor;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTMLTable.Cell;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;

public class MemberList extends Composite {
	@UiTemplate("MemberList.ui.xml")
	interface MemberListUiBinder extends UiBinder<Widget, MemberList> {	}
	private static MemberListUiBinder uiBinder = GWT.create(MemberListUiBinder.class);
	private Widget memberListPanel ;
	@UiField Image searchIcon ;
	@UiField Grid memberGrid ;
	public MemberList() {
		memberListPanel = uiBinder.createAndBindUi(this);
		searchIcon.getElement().getStyle().setCursor(Cursor.POINTER);
	    memberGrid.getElement().getStyle().setCursor(Cursor.POINTER);
	}
	
	public Widget getMemberListPanel(){
		return memberListPanel ;
	}
	
	@UiHandler("memberGrid")
	void onMouseClick(ClickEvent clickEvent){
		   Cell cell = memberGrid.getCellForEvent(clickEvent) ;
		    Window.alert(cell.getElement().getString()) ;
	} 

}
